<template>
	<div class="theme">
		<van-nav-bar :title="$t('Safety.v1')" :left-text="$t('MyDividend.v6')" left-arrow @click-left="onClickLeft" />
		<div class="overlay headTop">
			<div class="overlay-content scrolling" style="padding: 10px 10px;">
				<van-cell-group @click="payPwd" v-if="typeof payPwdType != 'string'">
					<van-field readonly :label="payPwdType == 1 ? $t('Safety.v2') : $t('Safety.v3')" right-icon="arrow" />
				</van-cell-group>
				<van-cell-group @click="$router.push({path: '/UpdatePwd'})">
					<van-field readonly :label="$t('Safety.v4')" right-icon="arrow" />
				</van-cell-group>
				<van-cell-group @click="$router.push({path: '/Auxiliaries'})">
					<van-field readonly :label="$t('Safety.v5')" right-icon="arrow" />
				</van-cell-group>
			</div>
		</div>
	</div>
</template>

<script>
	import { safety } from './../utils/api';
	export default {
		data() {
			return {
				payPwdType: ''
			}
		},
		created() {

		},
		mounted() {
			this.tradePass();
		},
		methods: {
			tradePass() { //交易密码
				safety.getTransaction().then(res => { // 判断是否设置交易密码
					if(res.data == 1) { // 1：已设置
						this.payPwdType = 1;
					} else {
						this.payPwdType = 0;
					}
				})
			},
			payPwd() {
				if(typeof this.payPwdType != 'string') {
					this.$router.push({
						path: '/UpdatePayPwd',
						query: {
							type: this.payPwdType
						}
					});
				}
			},
			onClickLeft() {
				this.$router.push({
					path: '/Mine'
				});
			}
		}
	}
</script>

<style lang="less" scoped>
	.van-hairline--bottom::after {
		border: 0;
	}
	
	.van-cell {
		font-size: 15px;
		padding: 15px;
	}
</style>